#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main()
{
	int n;
	cin >> n;
	map<int, int> m;
	int x = 0;
	for (int i = 0; i < n; i++) {
		cin >> x;
		m[x] += 1;
	}
	vector<pair<int, int>> v(m.begin(), m.end());
	sort(v.begin(), v.end(), [](pair<int, int> lhs, pair<int, int> rhs) {
		return lhs.first < rhs.first;
	});
	for (auto i = v.begin(); i != v.end(); ++i) {
		cout << i->first << " " << i->second << endl;
	}
	return 0;
}
